home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GameStar 2004 April
/
Gamestar_61_2004-04_dvdb.iso
/
DVDStar
/
Editace
/
hltp.exe
/
{app}
/
Source Code
/
Zoners Half-Life Tools
/
common
/
cmdlib.h
< prev
next >
Wrap
C/C++ Source or Header
|
2002-12-09
|
5KB
|
147 lines
#ifndef CMDLIB_H__
#define CMDLIB_H__
#if _MSC_VER >= 1000
#pragma once
#endif
#ifdef __MINGW32__
#include <io.h>
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
// AJM: gnu compiler fix
#ifdef __GNUC__
#define _alloca __builtin_alloca
#define alloca __builtin_alloca
#endif
#include "win32fix.h"
#include "mathtypes.h"
//#define MODIFICATIONS_STRING "Submit detailed bug reports to (zoner@gearboxsoftware.com)\n"
#define MODIFICATIONS_STRING "Submit detailed bug reports to (merlinis@bigpond.net.au)\n"
#ifdef _DEBUG
#define ZHLT_VERSIONSTRING "v2.5.3 dbg"
#else
#define ZHLT_VERSIONSTRING "v2.5.3 rel"
#endif
#define HACK_VERSIONSTRING "Custom Build 1.7"
//=====================================================================
// AJM: Different features of the tools can be undefined here
// these are not officially beta tested, but seem to work okay
// ZHLT_* features are spread across more than one tool. Hence, changing
// one of these settings probably means recompiling the whole set
#define ZHLT_INFO_COMPILE_PARAMETERS // ALL TOOLS
#define ZHLT_NULLTEX // HLCSG, HLBSP
#define ZHLT_TEXLIGHT // HLCSG, HLRAD - triggerable texlights by LRC
#define ZHLT_GENERAL // ALL TOOLS - general changes
//#define ZHLT_DETAIL // HLCSG, HLBSP - detail brushes
//#define ZHLT_PROGRESSFILE // ALL TOOLS - estimate progress reporting to -progressfile
//#define ZHLT_NSBOB
#define COMMON_HULLU // winding optimisations by hullu
// tool specific settings below only mean a recompile of the tool affected
#define HLCSG_CLIPECONOMY
#define HLCSG_WADCFG
#define HLCSG_AUTOWAD
//#define HLBSP_THREADS // estimate for hlbsp
#define HLVIS_MAXDIST
#define HLRAD_INFO_TEXLIGHTS
#define HLRAD_WHOME // encompases all of Adam Foster's changes
#define HLRAD_HULLU // semi-opaque brush based entities and effects by hullu
//=====================================================================
#ifdef SYSTEM_WIN32
#pragma warning(disable: 4127) // conditional expression is constant
#pragma warning(disable: 4115) // named type definition in parentheses
#pragma warning(disable: 4244) // conversion from 'type' to type', possible loss of data
// AJM
#pragma warning(disable: 4786) // identifier was truncated to '255' characters in the browser information
#pragma warning(disable: 4305) // truncation from 'const double' to 'float'
#pragma warning(disable: 4800) // forcing value to bool 'true' or 'false' (performance warning)
#endif
#ifdef STDC_HEADERS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
#include <time.h>
#include <stdarg.h>
#include <limits.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef ZHLT_NETVIS
#include "c2cpp.h"
#endif
#ifdef SYSTEM_WIN32
#define SYSTEM_SLASH_CHAR '\\'
#define SYSTEM_SLASH_STR "\\"
#endif
#ifdef SYSTEM_POSIX
#define SYSTEM_SLASH_CHAR '/'
#define SYSTEM_SLASH_STR "/"
#endif
// the dec offsetof macro doesn't work very well...
#define myoffsetof(type,identifier) ((size_t)&((type*)0)->identifier)
#define sizeofElement(type,identifier) (sizeof((type*)0)->identifier)
#ifdef SYSTEM_POSIX
extern char* strupr(char* string);
extern char* strlwr(char* string);
#endif
extern const char* stristr(const char* const string, const char* const substring);
extern bool CDECL safe_snprintf(char* const dest, const size_t count, const char* const args, ...);
extern bool safe_strncpy(char* const dest, const char* const src, const size_t count);
extern bool safe_strncat(char* const dest, const char* const src, const size_t count);
extern bool TerminatedString(const char* buffer, const int size);
extern char* FlipSlashes(char* string);
extern double I_FloatTime();
extern int CheckParm(char* check);
extern void DefaultExtension(char* path, const char* extension);
extern void DefaultPath(char* path, char* basepath);
extern void StripFilename(char* path);
extern void StripExtension(char* path);
extern void ExtractFile(const char* const path, char* dest);
extern void ExtractFilePath(const char* const path, char* dest);
extern void ExtractFileBase(const char* const path, char* dest);
extern void ExtractFileExtension(const char* const path, char* dest);
extern short BigShort(short l);
extern short LittleShort(short l);
extern int BigLong(int l);
extern int LittleLong(int l);
extern float BigFloat(float l);
extern float LittleFloat(float l);
#endif //CMDLIB_H__